const { Types } = require('mongoose')
const mongoose = require('./db')

// 定义用户模型
const userSchema = new mongoose.Schema({
    username: {
        type: String,
        required: true
    },
    password: {
        type: String,
        required: true
    }
})
let User = mongoose.model('User', userSchema)

// 定义题库模型
const questionSchema = new mongoose.Schema({
    questionType: { type: String, required: true }, // 题目类型
    subject: { type: String, required: true }, // 学科
    grade: { type: String, required: true }, // 年级
    difficulty: { type: String, required: true }, // 难度
    question: { type: String, required: true }, // 题目
    options: { type: [String], required: false }, // 选项
    answer: { type: Boolean, required: true }, // 答案
    explanation: { type: String, required: true } // 解析
})
let Question = mongoose.model('Question', questionSchema)


module.exports = { User, Question }